---
apiVersion: v1
kind: Service
metadata:
  name: loki-grafana
  labels:
    app: loki-grafana
spec:
  ports:
  - port: 3000
    name: http
    protocol: TCP
  clusterIP: None
  selector:
    app: loki-grafana
---
apiVersion: v1
kind: Service
metadata:
  name: loki-grafana-connect
  labels:
    app: loki-grafana
spec:
  type: ClusterIP
  ports:
  - port: 3000
    name: http
    protocol: TCP
  selector:
    app: loki-grafana
    statefulset.kubernetes.io/pod-name: loki-grafana-0
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: loki-grafana
  name: loki-grafana
spec:
  replicas: 1
  serviceName: loki-grafana
  selector:
    matchLabels:
      app: loki-grafana
  template:
    metadata:
      labels:
        app: loki-grafana
    spec:
      containers:
      - env: []
        image: grafana/grafana:8.0.6
        name: loki-grafana
        ports:
        - containerPort: 3000
          name: http
        readinessProbe:
          httpGet:
            path: /api/health
            port: http
        resources:
          limits:
            cpu: 200m
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
          - name: data
            mountPath: /var/lib/grafana
          - name: grafana-ini
            mountPath: /etc/grafana/grafana.ini
            subPath: grafana.ini
      volumes:
        - name: grafana-ini
          configMap:
            name: grafana-ini
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes: [ "ReadWriteOnce" ]
        storageClassName: "managed-nfs-storage"
        resources:
          requests:
            storage: 5Gi